<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic1">
  <title>gprestore</title>
  <body>
    <p>Restore a Greenplum Database backup that was created using the <codeph>gpbackup</codeph>
      utility. By default <codeph>gprestore</codeph> uses backed up metadata files and DDL files
      located in the Greenplum Database master host data directory, with table data stored locally
      on segment hosts in CSV data files.</p>
    <section>
      <title>Synopsis</title>
      <codeblock>gprestore --timestamp &lt;YYYMMDDHHMMSS>
   [--backup-dir &lt;directory>]
   [--create-db]
   [--debug]
   [--exclude-schema &lt;schema_name> [--exclude-schema &lt;schema_name> ...]]
   [--exclude-table &lt;schema.table> [--exclude-table &lt;schema.table> ...]]
   [--exclude-table-file &lt;file_name>]
   [--exclude-schema-file &lt;file_name>]
   [--include-schema &lt;schema_name> [--include-schema &lt;schema_name> ...]]
   [--include-table &lt;schema.table> [--include-table &lt;schema.table> ...]]
   [--include-schema-file &lt;file_name>]
   [--include-table-file &lt;file_name>]
   [--truncate-table]
   [--redirect-schema &lt;schema_name>]
   [--data-only | --metadata-only]
   [--incremental]
   [--jobs &lt;int>]
   [--on-error-continue]
   [--plugin-config &lt;config_file_location>]
   [--quiet]
   [--redirect-db &lt;database_name>]
   [--verbose]
   [--version]
   [--with-globals]
   [--with-stats]
   [--run-analyze]

gprestore --help</codeblock>
    </section>
    <section>
      <title>Description</title>
      <p>To use <codeph>gprestore</codeph> to restore from a backup set, you must include the
          <codeph>--timestamp</codeph> option to specify the exact timestamp value
          (<codeph>YYYYMMDDHHMMSS</codeph>) of the backup set to restore. If you specified a custom
          <codeph>--backup-dir</codeph> to consolidate the backup files, include the same
          <codeph>--backup-dir</codeph> option with <codeph>gprestore</codeph> to locate the backup
        files.</p>
      <p>If the backup you specify is an incremental backup, you need a complete set of backup files
        (a full backup and any required incremental backups). <codeph>gprestore</codeph> ensures
        that the complete backup set is available before attempting to restore a backup.
        <note type="important">For incremental backup sets, the backups must be on a single device.
          For example, a backup set must all be on a Data Domain system. </note></p>
      <p>For information about incremental backups, see <xref
          href="../../admin_guide/managing/backup-gpbackup-incremental.html" format="html" scope="external">Creating and Using Incremental Backups with gpbackup and gprestore</xref>.</p>
      <p>When restoring from a backup set, <codeph>gprestore</codeph> restores to a database with
        the same name as the name specified when creating the backup set. If the target database
        exists and a table being restored exists in the database, the restore operation fails.
        Include the <codeph>--create-db</codeph> option if the target database does not exist in the
        cluster. You can optionally restore a backup set to a different database by using the
          <codeph>--redirect-db</codeph> option.</p>
      <p>When restoring a backup set that contains data from some leaf partitions of a partitioned
        tables, the partitioned table is restored along with the data for the leaf partitions. For
        example, you create a backup with the <codeph>gpbackup</codeph> option
          <codeph>--include-table-file</codeph> and the text file lists some leaf partitions of a
        partitioned table. Restoring the backup creates the partitioned table and restores the data
        only for the leaf partitions listed in the file. </p>
      <p>By default, only database objects in the backup set are restored. Greenplum Database system
        objects are automatically included in a <codeph>gpbackup</codeph> backup set, but these
        objects are only restored if you include the <codeph>--with-globals</codeph> option to
          <codeph>gprestore</codeph>. </p>
      <p>During a restore operation, automatic updating of table statistics is disabled for the
        tables being restored. If you backed up query plan statistics using the
          <codeph>--with-stats</codeph> option, you can restore those statistics by providing
          <codeph>--with-stats</codeph> to <codeph>gprestore</codeph>. If you did not use
          <codeph>--with-stats</codeph> during a backup, or you want to collect current statistics
        during the restore operation, you can use the <codeph>--run-analyze</codeph> option to run
          <codeph>ANALYZE</codeph> on the restored tables. </p>
      <p>When a materialized view is restored, the data is not restored. To populate the
        materialized view with data, use <codeph>REFRESH MATERIALIZED VIEW</codeph>. The tables that
        are referenced by the materialized view definition must be available. The
          <codeph>gprestore</codeph> log file lists the materialized views that were restored and
        the <codeph>REFRESH MATERIALIZED VIEW</codeph> commands that are used to populate the
        materialized views with data.</p>
      <p>Performance of restore operations can be improved by creating multiple parallel connections
        to restore table data and metadata. By default <codeph>gprestore</codeph> uses 1 connection,
        but you can increase this number with the <codeph>--jobs</codeph> option for large restore
        operations.</p>
      <p>When a restore operation completes, <codeph>gprestore</codeph> returns a status code. See
          <xref href="#topic1/return_codes" format="dita"/>.</p>
      <p><codeph>gprestore</codeph> can send status email notifications after a back up operation
        completes. You specify when the utility sends the mail and the email recipients in a
        configuration file. See <xref
          href="../../admin_guide/managing/backup-gpbackup.html#topic_qwd_d5d_tbb" format="html" scope="external">Configuring Email Notifications</xref>.</p>
    </section>
    <note>This utility uses secure shell (SSH) connections between systems to perform its tasks. In
      large Greenplum Database deployments, cloud deployments, or deployments with a large number of
      segments per host, this utility may exceed the host's maximum threshold for unauthenticated
      connections. Consider updating the SSH <codeph>MaxStartups</codeph> and
        <codeph>MaxSessions</codeph> configuration parameters to increase this threshold. For more
      information about SSH configuration options, refer to the SSH documentation for your Linux
      distribution.</note>
    <section>
      <title>Options</title>
      <parml>
        <plentry>
          <pt><b>--timestamp</b>
            <varname>YYYYMMDDHHMMSS</varname></pt>
          <pd>Required. Specifies the timestamp of the <codeph>gpbackup</codeph> backup set to
            restore. By default <codeph>gprestore</codeph> tries to locate metadata files for the
            timestamp on the Greenplum Database master host in the
              <filepath>$MASTER_DATA_DIRECTORY/backups/YYYYMMDD/YYYYMMDDhhmmss/</filepath>
            directory, and CSV data files in the
              <filepath>&lt;seg_dir>/backups/YYYYMMDD/YYYYMMDDhhmmss/</filepath> directory of each
            segment host.</pd>
        </plentry>
        <plentry>
          <pt><b>--backup-dir</b>
            <varname>directory</varname></pt>
          <pd>Optional. Sources all backup files (metadata files and data files) from the specified
            directory. You must specify <varname>directory</varname> as an absolute path (not
            relative). If you do not supply this option, <codeph>gprestore</codeph> tries to locate
            metadata files for the timestamp on the Greenplum Database master host in the
              <filepath>$MASTER_DATA_DIRECTORY/backups/YYYYMMDD/YYYYMMDDhhmmss/</filepath>
            directory. CSV data files must be available on each segment in the
              <filepath>&lt;seg_dir>/backups/YYYYMMDD/YYYYMMDDhhmmss/</filepath> directory. Include
            this option when you specify a custom backup directory with
            <codeph>gpbackup</codeph>.</pd>
          <pd>You cannot combine this option with the option <codeph>--plugin-config</codeph>.</pd>
        </plentry>
        <plentry>
          <pt><b>--create-db</b></pt>
          <pd>Optional. Creates the database before restoring the database object metadata.</pd>
          <pd>The database is created by cloning the empty standard system database
              <codeph>template0</codeph>.</pd>
        </plentry>
        <plentry id="data_only">
          <pt><b>--data-only</b></pt>
          <pd>Optional. Restores table data from a backup created with the <codeph>gpbackup</codeph>
            utility, without creating the database tables. This option assumes the tables exist in
            the target database. To restore data for a specific set of tables from a backup set, you
            can specify an option to include tables or schemas or exclude tables or schemas. Specify
            the <codeph>--with-stats</codeph> option to restore table statistics from the
            backup.</pd>
          <pd>The backup set must contain the table data to be restored. For example, a backup
            created with the <codeph>gpbackup</codeph> option <codeph>--metadata-only</codeph> does
            not contain table data.</pd>
          <pd><codeph>SEQUENCE</codeph> values are updated to match the values taken at the time of
            the backup.</pd>
          <pd>To restore only database tables, without restoring the table data, see the option
              <xref href="#topic1/metadata_only" format="dita">--metadata-only</xref>.</pd>
        </plentry>
        <plentry>
          <pt><b>--debug</b></pt>
          <pd>Optional. Displays verbose and debug log messages during a restore operation.</pd>
        </plentry>
        <plentry>
          <pt><b>--exclude-schema</b>
            <varname>schema_name</varname></pt>
          <pd>Optional. Specifies a database schema to exclude from the restore operation. You can
            specify this option multiple times. You cannot combine this option with the option
              <codeph>--include-schema</codeph>, <codeph>--include-schema-file</codeph>, or a table
            filtering option such as <codeph>--include-table</codeph>. </pd>
        </plentry>
        <plentry>
          <pt><b>--exclude-schema-file</b>
            <varname>file_name</varname></pt>
          <pd>Optional. Specifies a text file containing a list of schemas to exclude from the
            backup. Each line in the text file must define a single schema. The file must not
            include trailing lines. If a schema name uses any character other than a lowercase
            letter, number, or an underscore character, then you must include that name in double
            quotes. You cannot combine this option with the option <codeph>--include-schema</codeph>
            or <codeph>--include-schema-file</codeph>, or a table filtering option such as
              <codeph>--include-table</codeph>.</pd>
        </plentry>
        <plentry>
          <pt><b>--exclude-table</b> &lt;schema.table></pt>
          <pd>Optional. Specifies a table to exclude from the restore operation. You can specify
            this option multiple times. The table must be in the format
              <codeph>&lt;schema-name>.&lt;table-name></codeph>. If a table or schema name uses any
            character other than a lowercase letter, number, or an underscore character, then you
            must include that name in double quotes. You can specify this option multiple times. If
            the table is not in the backup set, the restore operation fails. You cannot specify a
            leaf partition of a partitioned table.</pd>
          <pd>You cannot combine this option with the option <codeph>--exclude-schema</codeph>,
              <codeph>--exclude-schema-file</codeph>, or another a table filtering option such as
              <codeph>--include-table</codeph>.</pd>
        </plentry>
        <plentry>
          <pt><b>--exclude-table-file</b>
            <varname>file_name</varname></pt>
          <pd>Optional. Specifies a text file containing a list of tables to exclude from the
            restore operation. Each line in the text file must define a single table using the
            format <codeph>&lt;schema-name>.&lt;table-name></codeph>. The file must not include
            trailing lines. If a table or schema name uses any character other than a lowercase
            letter, number, or an underscore character, then you must include that name in double
            quotes. If a table is not in the backup set, the restore operation fails. You cannot
            specify a leaf partition of a partitioned table.</pd>
          <pd>You cannot combine this option with the option <codeph>--exclude-schema</codeph>,
              <codeph>--exclude-schema-file</codeph>, or another a table filtering option such as
              <codeph>--include-table</codeph>.</pd>
        </plentry>
        <plentry>
          <pt><b>--include-schema</b>
            <varname>schema_name</varname></pt>
          <pd>Optional. Specifies a database schema to restore. You can specify this option multiple
            times. If you specify this option, any schemas that you specify must be available in the
            backup set. Any schemas that are not included in subsequent
              <codeph>--include-schema</codeph> options are omitted from the restore operation. </pd>
          <pd>If a schema that you specify for inclusion exists in the database, the utility issues
            an error and continues the operation. The utility fails if a table being restored exists
            in the database. </pd>
          <pd>You cannot use this option if objects in the backup set have dependencies on multiple
            schemas.</pd>
          <pd>See <xref href="../../admin_guide/managing/backup-gpbackup.html#topic_et4_b5d_tbb" format="html" scope="external"
              >Filtering the Contents of a Backup or Restore</xref> for more information.</pd>
        </plentry>
        <plentry>
          <pt><b>--include-schema-file</b>
            <varname>file_name</varname></pt>
          <pd>Optional. Specifies a text file containing a list of schemas to restore. Each line in
            the text file must define a single schema. The file must not include trailing lines. If
            a schema name uses any character other than a lowercase letter, number, or an underscore
            character, then you must include that name in double quotes. </pd>
          <pd>The schemas must exist in the backup set. Any schemas not listed in this file are
            omitted from the restore operation. </pd>
          <pd>You cannot use this option if objects in the backup set have dependencies on multiple
            schemas.</pd>
        </plentry>
        <plentry>
          <pt><b>--include-table</b>
            <varname>schema.table</varname></pt>
          <pd>Optional. Specifies a table to restore. The table must be in the format
            &lt;schema-name>.&lt;table-name>. You can specify this option multiple times. You cannot
            specify a leaf partition of a partitioned table. For information on specifying special
            characters in schema and table names, see the <codeph>gpbackup</codeph>
            <xref href="gpbackup.xml#topic1__table_names" format="dita">Schema and Table
              Names</xref> section. </pd>
          <pd>You can also specify the qualified name of a sequence, a view, or a materialized view. </pd>
          <pd>If you specify this option, the utility does not automatically restore dependent
            objects. You must also explicitly specify the dependent objects that are required. For
            example if you restore a view or a materialized view, you must also restore the tables
            that the view or the materialized view uses. If you restore a table that uses a
            sequence, you must also restore the sequence. The dependent objects must exist in the
            backup set.</pd>
          <pd>You cannot combine this option with a schema filtering option such as
              <codeph>--include-schema</codeph>, or another table filtering option such as
              <codeph>--exclude-table-file</codeph>.</pd>
        </plentry>
        <plentry>
          <pt><b>--include-table-file</b>
            <varname>file_name</varname></pt>
          <pd>Optional. Specifies a text file containing a list of tables to restore. Each line in
            the text file must define a single table using the format
              <codeph>&lt;schema-name>.&lt;table-name></codeph>. The file must not include trailing
            lines. Any tables not listed in this file are omitted from the restore operation. You
            cannot specify a leaf partition of a partitioned table. For information on specifying
            special characters in schema and table names, see the <codeph>gpbackup</codeph>
            <xref href="gpbackup.xml#topic1__table_names" format="dita">Schema and Table
              Names</xref> section. </pd>
          <pd>You can also specify the qualified name of a sequence, a view, or a materialized view. </pd>
          <pd>If you specify this option, the utility does not automatically restore dependent
            objects. You must also explicitly specify dependent objects that are required. For
            example if you restore a view or a materialized view, you must also specify the tables
            that the view or the materialized uses. If you specify a table that uses a sequence, you
            must also specify the sequence. The dependent objects must exist in the backup set.</pd>
          <pd>For a materialized view, the data is not restored. To populate the materialized view
            with data, you must use <codeph>REFRESH MATERIALIZED VIEW</codeph> and the tables that
            are referenced by the materialized view definition must be available.</pd>
          <pd>If you use the <codeph>--include-table-file</codeph> option,
              <codeph>gprestore</codeph> does not create roles or set the owner of the tables. The
            utility restores table indexes and rules. Triggers are also restored but are not
            supported in Greenplum Database.</pd>
          <pd>See <xref href="../../admin_guide/managing/backup-gpbackup.html#topic_et4_b5d_tbb" format="html" scope="external">Filtering the Contents of a Backup or Restore</xref>
            for more information.</pd>
        </plentry>
        <plentry>
          <pt>--incremental (Beta)</pt>
          <pd>Optional. Requires the <codeph>--data-only option</codeph>. Restores only the table
            data in the incremental backup specified by the <codeph>--timestamp</codeph> option.
            Table data is not restored from previous incremental backups in the backup set. For
            information about incremental backups, see <xref
              href="../../admin_guide/managing/backup-gpbackup-incremental.html" format="html" scope="external"/>.
            <note type="warning">This is a Beta feature<ph otherprops="pivotal"> and is not
                supported in a production environment</ph>.</note></pd>
          <pd>An incremental backup contains the following table data that can be restored.</pd>
          <pd>
            <ul id="ul_idp_wrn_tkb">
              <li>Data from all heap tables.</li>
              <li>Data from append-optimized tables that have been modified since the previous
                backup.</li>
              <li>Data from leaf partitions that have been modified from the previous backup.</li>
            </ul>
          </pd>
          <pd>When this option is specified, <codeph>gprestore</codeph> restores table data by
            truncating the table and reloading data into the table. <codeph>SEQUENCE</codeph> values
            are then updated to match the values taken at the time of the backup. </pd>
          <pd>Before performing the restore operation, <codeph>gprestore</codeph> ensures that the
            tables being restored exist. If a table does not exist, <codeph>gprestore</codeph>
            returns an error and exits. If the <codeph>--on-error-continue</codeph> option is
            specified, <codeph>gprestore</codeph> logs missing tables and attempts to complete the
            restore operation. </pd>
          <pd>
            <note type="warning">When this option is specified, <codeph>gpbackup</codeph> assumes
              that no changes have been made to the table definitions of the tables being restored,
              such as adding or removing columns. </note>
          </pd>
        </plentry>
        <plentry>
          <pt><b>--truncate-table</b></pt>
          <pd>Optional. Truncate data from a set of tables before restoring the table data from a
            backup. This option lets you replace table data with data from a backup. Otherwise,
            table data might be duplicated.</pd>
          <pd>You must specify the set of tables with either the option
              <codeph>--include-table</codeph> or <codeph>--include-table-file</codeph>. You must
            also specify <codeph>--data-only</codeph> to restore table data without creating the
            tables.</pd>
          <pd>You can use this option with the <codeph>--redirect-db</codeph> 
              option. You cannot use this option with
              <codeph>--redirect-schema</codeph>.</pd>
        </plentry>
        <plentry>
          <pt><b>--redirect-schema</b>
            <varname>schema_name</varname></pt>
          <pd>Optional. Restore data in the specified schema instead of the original schemas. The
            specified schema must already exist. If the data being restored is in multiple schemas,
            all the data is redirected into the specified schema.</pd>
          <pd>This option must be used with an option that includes tables or schemas:
              <codeph>--include-table</codeph>, <codeph>--include-table-file</codeph>,
              <codeph>--include-schema</codeph>, or <codeph>--include-schema-file</codeph>. </pd>
          <pd>You cannot use this option with an option that excludes schemas or tables such as
              <codeph>--exclude-schema</codeph> or <codeph>--exclude-table</codeph>.</pd>
          <pd>You can use this option with the <codeph>--metadata-only</codeph> or
              <codeph>--data-only</codeph> options.</pd>
        </plentry>
        <plentry>
          <pt><b>--jobs</b>
            <varname>int</varname></pt>
          <pd>Optional. Specifies the number of parallel connections to use when restoring table
            data and metadata. By default, <codeph>gprestore</codeph> uses 1 connection. Increasing
            this number can improve the speed of restoring data.
            <note>If you used the <codeph>gpbackup --single-data-file</codeph> option to combine
              table backups into a single file per segment, you cannot set <codeph>--jobs</codeph>
              to a value higher than 1 to perform a parallel restore operation.</note></pd>
        </plentry>
        <plentry id="metadata_only">
          <pt><b>--metadata-only</b></pt>
          <pd>Optional. Creates database tables from a backup created with the
              <codeph>gpbackup</codeph> utility, but does not restore the table data. This option
            assumes the tables do not exist in the target database. To create a specific set of
            tables from a backup set, you can specify an option to include tables or schemas or
            exclude tables or schemas. Specify the option <codeph>--with-globals</codeph> to restore
            the Greenplum Database system objects.</pd>
          <pd>The backup set must contain the DDL for tables to be restored. For example, a backup
            created with the <codeph>gpbackup</codeph> option <codeph>--data-only</codeph> does not
            contain the DDL for tables. </pd>
          <pd>To restore table data after you create the database tables, see the option <xref
              href="#topic1/data_only" format="dita">--data-only</xref>.</pd>
        </plentry>
        <plentry>
          <pt><b>--on-error-continue</b></pt>
          <pd>Optional. Specify this option to continue the restore operation if an SQL error occurs
            when creating database metadata (such as tables, roles, or functions) or restoring data.
            If another type of error occurs, the utility exits. The default is to exit on the first
            error.</pd>
          <pd>When this option is included, the utility displays an error summary and writes error
            information to the <codeph>gprestore</codeph> log file and continues the restore
            operation. The utility also creates text files in the backup directory that contain the
            list of tables that generated SQL errors. <ul id="ul_d5j_5zn_3kb">
              <li>Tables with metadata errors -
                  <codeph>gprestore_&lt;backup-timestamp>_&lt;restore-time>_error_tables_metadata</codeph></li>
              <li>Tables with data errors -
                  <codeph>gprestore_&lt;backup-timestamp>_&lt;restore-time>_error_tables_data</codeph></li>
            </ul></pd>
        </plentry>
        <plentry>
          <pt><b>--plugin-config</b>
            <varname>config-file_location</varname></pt>
          <pd>Specify the location of the <codeph>gpbackup</codeph> plugin configuration file, a
            YAML-formatted text file. The file contains configuration information for the plugin
            application that <codeph>gprestore</codeph> uses during the restore operation.</pd>
          <pd>If you specify the <codeph>--plugin-config</codeph> option when you back up a
            database, you must specify this option with configuration information for a
            corresponding plugin application when you restore the database from the backup.</pd>
          <pd>You cannot combine this option with the option <codeph>--backup-dir</codeph>.</pd>
          <pd>For information about using storage plugin applications, see <xref
              href="../../admin_guide/managing/backup-plugins.html" format="html" scope="external">Using gpbackup Storage
              Plugins</xref>.</pd>
        </plentry>
        <plentry>
          <pt><b>--quiet</b></pt>
          <pd>Optional. Suppress all non-warning, non-error log messages.</pd>
        </plentry>
        <plentry>
          <pt><b>--redirect-db</b>
            <varname>database_name</varname></pt>
          <pd>Optional. Restore to the specified <varname>database_name</varname> instead of to the
            database that was backed up.</pd>
        </plentry>
        <plentry>
          <pt><b>--verbose</b></pt>
          <pd>Optional. Displays verbose log messages during a restore operation.</pd>
        </plentry>
        <plentry>
          <pt><b>--version</b></pt>
          <pd>Optional. Print the version number and exit.</pd>
        </plentry>
        <plentry>
          <pt><b>--with-globals</b></pt>
          <pd>Optional. Restores Greenplum Database system objects in the backup set, in addition to
            database objects. See <xref
              href="../../admin_guide/managing/backup-gpbackup.html#topic_x3s_lqj_tbb" format="html" scope="external">Objects Included in a Backup or Restore</xref>.</pd>
        </plentry>
        <plentry>
          <pt><b>--with-stats</b></pt>
          <pd>Optional. Restore query plan statistics from the backup set. If the backup set was not
            created with the <codeph>--with-stats</codeph> option, an error is returned. Restored
            tables will only have statistics from the backup. You cannot use this option with
              <codeph>--run-analyze</codeph>.</pd>
          <pd>To collect current statistics for the restored tables during the restore operation,
            use the <codeph>--run-analyze</codeph> option. As an alternative, you can run the
              <codeph>ANALYZE</codeph> command on the tables after the tables are restored. </pd>
        </plentry>
        <plentry>
          <pt><b>--run-analyze</b></pt>
          <pd>Optional. Run <codeph>ANALYZE</codeph> on the tables that are restored. For a
            partitioned table, <codeph>ANALYZE</codeph> is run on the root partitioned table. If
              <codeph>--with-stats</codeph> was specified for the backup, those statistics are
            ignored. You cannot use this option with <codeph>--with-stats</codeph>. </pd>
          <pd>If the backup being restored used the <codeph>gpbackup</codeph> option <xref
              href="gpbackup.xml#topic1/backup_leaf_part">--leaf-partition-data</xref>,
              <codeph>gprestore</codeph> runs <codeph>ANALYZE</codeph> only on the individual leaf
            partitions that are restored, not the root partitioned table. For Greenplum Database 5,
              <codeph>ANALYZE</codeph> updates the root partitioned table statistics when all leaf
            partitions have statistics as the default. For Greenplum Database 4, you must run
              <codeph>ANALYZE</codeph> on the root partitioned table to update the root partition
            statistics.</pd>
          <pd>Depending the tables being restored, running <codeph>ANALYZE</codeph> on restored
            tables might increase the duration of the restore operation.</pd>
        </plentry>
        <plentry>
          <pt>--help</pt>
          <pd>Displays the online help.</pd>
        </plentry>
      </parml>
    </section>
    <section id="return_codes">
      <title>Return Codes</title>
      <p>One of these codes is returned after <codeph>gprestore</codeph> completes.<ul
          id="ul_hhb_sqp_n4">
          <li><b>0</b> – Restore completed with no problems.</li>
          <li><b>1</b> – Restore completed with non-fatal errors. See log file for more
            information.</li>
          <li><b>2</b> – Restore failed with a fatal error. See log file for more information.</li>
        </ul></p>
    </section>
    <section>
      <title>Examples</title>
      <p>Create the demo database and restore all schemas and tables in the backup set for the
        indicated
        timestamp:<codeblock>$ dropdb demo
$ gprestore --timestamp 20171103152558 --create-db</codeblock></p>
      <p>Restore the backup set to the "demo2" database instead of the "demo" database that was
        backed
        up:<codeblock>$ createdb demo2
$ gprestore --timestamp 20171103152558 --redirect-db demo2</codeblock></p>
      <p>Restore global Greenplum Database metadata and query plan statistics in addition to the
        database
        objects:<codeblock>$ gprestore --timestamp 20171103152558 --create-db --with-globals --with-stats</codeblock></p>
      <p>Restore, using backup files that were created in the
          <filepath>/home/gpadmin/backup</filepath> directory, creating 8 parallel
        connections:<codeblock>$ gprestore --backup-dir /home/gpadmin/backups/ --timestamp 20171103153156 --create-db --jobs 8</codeblock></p>
      <p>Restore only the "wikipedia" schema included in the backup
        set:<codeblock>$ dropdb demo
$ gprestore --include-schema wikipedia --backup-dir /home/gpadmin/backups/ --timestamp 20171103153156 --create-db</codeblock></p>
      <p>If you restore from an incremental backup set, all the required files in the backup set
        must be available to <codeph>gprestore</codeph>. For example, the following timestamp keys
        specify an incremental backup set. 20170514054532 is the full backup and the others are
        incremental backups.</p>
      <pre>20170514054532 (full backup)
20170714095512 
20170914081205 
20171114064330 
20180114051246</pre>
      <p>The following <codeph>gprestore</codeph> command specifies the timestamp 20121114064330.
        The incremental backup with the timestamps 20120714095512 and 20120914081205 and the full
        backup must be available to perform a restore.</p>
      <codeblock>gprestore --timestamp 20121114064330 --redirect-db mystest --create-db</codeblock>
    </section>
    <section id="section9">
      <title>See Also</title>
      <p>
        <xref href="./gpbackup.xml" type="topic" format="dita"/>, <xref
          href="../../admin_guide/managing/backup-gpbackup.html" format="html" scope="external"
          >Parallel Backup with gpbackup and gprestore</xref> and <xref
          href="../../admin_guide/managing/backup-s3-plugin.html" format="html" scope="external"
          >Using the S3 Storage Plugin with gpbackup and gprestore</xref></p>
    </section>
  </body>
</topic>
